Security component for devices on an enumerated bus

ABSTRACT

A plug-and-play (PnP) driver associated with a security agent is described herein. The PnP driver attaches to device stacks of enumerated bus devices of a computing device as upper-device or lower-device filters based on the device classes of the enumerated bus devices. For example, the PnP driver may attach to the device stack of a hub or controller device as an upper-device filter and to device stacks of other devices as lower-device filters. Either while attaching or after attachment, the PnP driver may take action to alter, limit, or otherwise block functionality of an enumerated bus device. The PnP driver may also perform a system inventory of enumerated bus devices connected to the computing device and create fingerprints for one or more of the computing devices. Additionally, the PnP driver may create and remove control device objects (CDOs) to enable communication with user-mode processes or threads.

BACKGROUND

With Internet use forming an ever greater part of day to day life,security exploits that steal or destroy system resources, data, andprivate information are an increasing problem. Governments andbusinesses devote significant resources to preventing intrusions andthefts related to these security exploits. Security exploits come inmany forms, such as computer viruses, worms, trojan horses, spyware,keystroke loggers, adware, and rootkits. These exploits are delivered inor through a number of mechanisms, such as spearfish emails, clickablelinks, documents, executables, or archives. Some of the threats posed bysecurity exploits are of such significance that they are described ascyber terrorism or industrial espionage.

Many security exploits are delivered through devices on an enumeratedbus, such as universal serial bus (USB) devices, or through devices,processes, or threads posing as such devices on an enumerated bus. Otherthreats tied to devices on an enumerated bus include insider threats(e.g., stealing proprietary information) and insertion of a base device(e.g., on a laptop, by mistake or directly, by a malicious person).Current techniques for detecting these security exploits and threats arelimited. For example, if serial numbers of malicious USB devices areknown, such devices may be detected and blocked. Device serial numbersare not always known or available, however.

BRIEF DESCRIPTION OF THE DRAWINGS

The detailed description is set forth with reference to the accompanyingfigures. In the figures, the left-most digit(s) of a reference numberidentifies the figure in which the reference number first appears. Theuse of the same reference numbers in different figures indicates similaror identical items or features.

FIG. 1 illustrates an example computing environment including acomputing device, enumerated bus devices connected to that computingdevice, and software components for managing and securing the computingdevice and enumerated bus devices.

FIG. 2 illustrates an example process for loading a plug-and-play (PnP)driver as an upper-device filter in a device stack of a hub of acomputing device and for attaching the PnP driver to device stacks ofother enumerated bus devices of the computing device as either anupper-device filter or lower-device filter depending on device classesof those enumerated bus devices.

FIG. 3 illustrates an example process for taking actions by a PnP driverattached or attaching to a device stack of an enumerated bus device as afilter, including blocking, inventorying, and fingerprinting, amongothers.

FIG. 4 illustrates an example process for taking action by a PnP driverto alter, limit, or otherwise block functionality of an enumerated busdevice.

FIG. 5 illustrates an example process for creating, by a PnP driver, acontrol device object (CDO) to enable communication with a user-modeprocess or thread and for removing the CDO.

DETAILED DESCRIPTION

This disclosure describes, in part, a PnP driver associated with asecurity agent. The PnP driver attaches to device stacks of devices ofan enumerated bus (also referred to herein as “enumerated bus devices”)of a computing device as upper-device or lower-device filters based onthe device classes of the enumerated bus devices. For example, the PnPdriver may attach to the device stack of a hub or controller device asan upper-device filter and to device stacks of other devices aslower-device filters. Either while attaching or after attachment, thePnP driver may take action to alter, limit, or otherwise blockfunctionality of an enumerated bus device, such as a USB device. The PnPdriver may also perform a system inventory of enumerated bus devicesconnected to the computing device and create fingerprints for one ormore of the computing devices. Additionally, the PnP driver may createand remove CDOs to enable communication with user-mode processes orthreads.

As used herein, “enumerated bus devices” include a broad range of devicetypes, such as USB devices defined by the USB specification regardlessof whether or not those device types are specifically classified as USBdevices by the operating system of the computing device. Enumerated busdevices may include, for instance, any internal or external devices onan enumerated bus.

In various implementations, when loaded, the PnP driver receives amessage, such as an enumeration of enumerated bus devices attached to ahub device or controller, from a driver of that hub device orcontroller. The PnP driver may be attached as an upper-device filter inthe device stack of such a hub device or controller. Upon receiving themessage, the PnP driver iterates through the enumerated bus devices anddetermines, for each enumerated bus device, whether the enumerated busdevice is a hub or controller. The PnP driver then attaches as anupper-device filter or lower-device filter in the device stack of eachof the enumerated bus devices based at least in part on the device classof that enumerated bus device (e.g., whether the enumerated bus deviceis a hub/controller or is another sort of device).

In some implementations, in a decision phase prior to attachment to anenumerated bus device, the PnP driver may compare indicative features ofthat enumerated bus device to configuration policies of the PnP driverand may decide to alter, limit, or otherwise block functionality of theenumerated bus device. Such configuration policies may includecombinations of indicative features that form indicators of attack (IoA)associated with known security exploits or devices that contain knownmalicious firmware or firmware that is determined to be malicious basedon static properties extracted from indicative features and/orbehavioral properties extracted from inspection of data sent to/from thedevice. Upon determining that functionality of an enumerated bus deviceshould be altered, limited, or otherwise blocked, the PnP driver storesan indication of the decision and may act upon it in one or moreenforcement phases, as specified in configuration policy.

In some implementations, the PnP driver or another component maycalculate a hash or other unique descriptor for an enumerated busdevice. Such a calculation may occur during or after a first appearanceof that enumerated bus device for comparison of its indicative featuresto the configuration policy. The decision reached during the decisionphase may then be associated with the hash or unique descriptor so thatupon any subsequent attachments/appearances of the enumerated busdevice, previous decision is referred to and the comparison to theconfiguration policies is not repeated. Thus, use of the hash or uniquedescriptor and its association with a decision saves the need forsubsequent processing which would simply repeat the comparison ofindicative features to configuration policy.

The ability to identify unique devices also greatly reduces datatransmission and storage costs when sending device information to acloud service, such as a remote security service. For example, a companymay standardize on a certain type of mouse for their employees. Assumingthese mice are all the same type and were made on the same assemblyline, they will all contain the exact same firmware image. This may meanthat their indicative features will be identical. Ideally such a hash orunique descriptor would only be reported once, the first time it is seenon any computer, or once per system, for every system. Bounding thesehash or unique descriptors is done by restricting transmission based onthe SHA-256 hash of all of the indicative features that are collected(currently device, configuration, interface, endpoint), which are calleda descriptor set. The PNP driver retrieves a device's indicativefeatures, hashes them, and transmits them to a remote security serviceif they have not previously been sent on that system. If the sameindicative feature set is seen again on this system (e.g., the device isplugged into a different port, ejected and reinserted, or a secondidentical device is plugged in), it will not be transmitted to theremote security service. This bounding is persisted across systemreboots.

In an enforcement phase, the PnP driver may alter, limit, or otherwiseblock the functionality of the enumerated bus device. Such altering,limiting, or blocking may occur during installation for the enumeratedbus device, before its driver has been located, or after installation,during a device start for the enumerated bus device. In this lattercase, the PnP driver attaches to the USB device as a filter in thedevice stack of the enumerated bus device. The PnP driver may then faila device start command from a PnP manager, causing the device start tofail and the device stack for the enumerated bus device to be torn down.Other altering, limiting, or blocking techniques include alteringinstallation strings or capability flags for the enumerated bus device;requesting powering off, disabling, or power cycling of the port for theenumerated bus device; returning a failure status for an add deviceroutine; removing an identifier of the enumerated bus device from anenumeration of enumerated bus devices; suspending the enumerated busdevice by updating a state machine of a hub device; or taking anyfurther action based on the configurable policies.

In some implementations, the PnP driver may also decide to alter, limit,or otherwise block an enumerated bus device after its installation andstart based on analysis of traffic associated with the enumerated busdevice. For example, the PnP driver, which may be attached to the devicestack of the enumerated bus device, may generate traffic and transmitthe traffic to the driver for that enumerated bus device. The PnP drivermay then monitor the response, and if the response indicates that theenumerated bus device may be different from what it claims to be, thePnP driver may decide to alter, limit, or otherwise block functionalityof the enumerated bus device or to monitor it further.

In various implementations, the PnP driver may inventory the enumeratedbus devices connected to the computing device and provide thatinformation to a security agent on the computing device or to a remotesecurity service. Such an inventory may be provided in the form of a PnPdevice tree, for example. The information gathered while inventoryingenumerated bus devices may also be used to create a fingerprint for eachenumerated bus device that may be used like a serial number to uniquelyidentify the enumerated bus device. Such gathered information may alsobe combined with information maintained by a remote security service togenerate the fingerprints.

In further implementations, the PnP driver may create a CDO to enablecommunication between the PnP driver and a user-mode process or thread.The CDO enables the user-mode process or thread to configure or controlthe PnP driver. The PnP driver may also remove the CDO when either acount associated with USB devices connected to the computing devicereaches zero or when the PnP driver receives a shutdown command from theuser-mode process or thread.

Environment

FIG. 1 illustrates an example computing environment including acomputing device, enumerated bus devices connected to that computingdevice, and software components for managing and securing the computingdevice and enumerated bus devices. As illustrated, a computing device102 may include an enumerated bus hub 104 (internal to the computingdevice 102), such as a USB hub, and may be connected to multipleenumerated bus devices such as a mouse 106 and a thumb drive 108.Additionally, the computing device 102 may be connected to a securityservice cloud 110 and receive security service from the security servicecloud 110. The computing device 102, may also include a processor 112and memory 114, the memory 114 storing an operating system 116, aregistry 118, a PnP manager 120, and device stacks 122. The devicestacks 122 may each include an enumerated bus driver/physical deviceobject (PDO) 124 and a PnP driver 126 attached as a filter. Such afilter is often referred to as an F-DO. The memory 114 may also storeCDOs 128 and a security agent 130. Additionally, the computing device102 may have other memory devices 132, be connected to other enumeratedbus devices 134, be connected to input/output devices 136, and haveconnections 138 with other computing device(s). Further, the devicestacks 122 may include at least device stacks 122 for the hub 104, mouse106, and thumb drive 108, each device stack 122 including a PDO 124 anda function device object (FDO) 140, as well as a PnP driver 126 attachedeither as an upper-device filter above the FDO 140 or as a lower-devicefilter between the PDO 124 and FDO 140.

In various implementations, a computing device 102 may be any sort ofcomputing device equipped with one or more external enumerated bus portsand/or one or more internal ports found on internal hubs. For example,the computing device 102 may be a work station, a personal computer(PC), a laptop computer, a tablet computer, a personal digital assistant(PDA), a cellular phone, a media center, an embedded system, a server orserver farm, multiple, distributed server farms, a mainframe, or anyother sort of device or devices.

The computing device 102 includes as least one hub 104. The hub 104 maybe a root hub, a non-root hub, or a child hub connected to a root hub.Hub 104 may represent multiple connected hubs of the computing device104. Hub 104 may include one or more external enumerated bus ports forphysically connecting to external enumerated bus devices, such as mouse106, thumb drive 108, or other enumerated bus devices 134. Mouse 106 maybe a cordless mouse that wirelessly communicates with a USB dongle thatcouples with an enumerated bus port of hub 104 or a wired mouse with anenumerated bus connector that couples with an enumerated bus port of hub104. Thumb drive 108 may be any sort of thumb drive that includes anenumerated bus connector that couples with an enumerated bus port of hub104. Further, the other enumerated bus devices 134 may be any sort ofenumerated bus devices, such as keyboards, microphones, display devices,audio speakers, printers, barcode readers, image scanners, webcams, gamecontrollers, light pens, projectors, digital cameras, etc.

In some implementations, the computing device 102 and security servicecloud 110 may be connected by any sort of network or networks, such aswide area networks (WANs), local area networks (LANs), the Internet, orany combination of such networks.

In various implementations, the security service cloud 110 implements aremote security service that interfaces with security agents 130,security agent PnP drivers 126, or both from computing device 102 andother computing devices. The security service cloud 110 may aggregateand analyze information received from the computing device 102 and othercomputing devices (such as system inventories, enumerated bus devicefingerprints, traffic information, user-login identifications, etc.) andmay take actions, such as updating configurations of security agents130, security agent PnP drivers 126, or both, or sending commands to thecomputing devices to take some action (e.g., alter, limit, or otherwiseblock functionality of a device or process). The security service cloud110 may also participate in creating fingerprints for enumerated busdevices, as discussed in greater detail herein.

The security agent 130 may be a kernel-level security agent, which maymonitor and record activity on the computing device 102, may analyze theactivity, and may generate alerts and events and provide those alertsand events to the security service cloud 110. The security agent 130 maybe installed by and configurable by the security service cloud 110,receiving, and applying while live, configurations of the security agent130 and its component(s), such as security agent PnP driver 126. Anexample security agent 130 is described in greater detail in U.S. patentapplication Ser. No. 13/492,672, entitled “Kernel-Level Security Agent”and filed on Jun. 8, 2012, which issued as U.S. Pat. No. 9,043,903 onMay 26, 2015.

In various implementations, the security agent PnP driver 126 (alsoreferred to herein as PnP driver 126) may be a component of the securityagent 130 loaded based on actions of the security agent 130, operatingsystem 116, and the PnP manager 120. For instance, the security agent130 may write a registry key associated with a hub device, such as aroot hub, to the registry 118, causing the PnP manager 120 to load thePnP driver 126 as an upper-device filter in the device stack 122 of thehub device. Once loaded, the PnP driver 126 may attach to device stacksof other enumerated bus devices of the computing device 102 as a filter,may perform a system inventory on the enumerated bus devices, createfingerprints for the enumerated bus devices, and alter, limit, orotherwise block enumerated bus devices. The PnP driver 126 may alsocreate a CDO 128 to communicate with the security agent 130, enablingthe security agent 130 to control and/or configure the PnP driver 126through the CDO 128. Further, the PnP driver 126 may identify the userlogged in at the time that the already-logged-in user plugs in a newenumerated bus device and report the association of the user-logininformation with the enumerated bus device to the security agent 130 orto a remote security service. The loading, attaching, and otheroperations of the PnP driver 126 are described herein in greater detailwith reference to FIGS. 2-5.

In some implementations, the processor(s) 112 include a centralprocessing unit (CPU), a graphics processing unit (GPU), or both CPU andGPU, or other processing unit or component known in the art.

In various implementations, memory 114 may be system memory and isvolatile (such as RANI), non-volatile (such as ROM, flash memory, etc.)or some combination of the two. Computing device 102 also includesadditional data storage devices (removable and/or non-removable) suchas, for example, magnetic disks, optical disks, or tape. Such additionalstorage is illustrated in FIG. 1 by other memor(ies) 132. Non-transitorycomputer-readable media may include volatile and nonvolatile, removableand non-removable tangible, physical media implemented in technology forstorage of information, such as computer readable instructions, datastructures, program modules, or other data. System memory 114 and othermemor(ies) 132 are all examples of non-transitory computer-readablemedia. Non-transitory computer-readable media include, but are notlimited to, RAM, ROM, EEPROM, flash memory or other memory technology,CD-ROM, digital versatile disks (DVD) or other optical storage, magneticcassettes, magnetic tape, magnetic disk storage or other magneticstorage devices, or any other tangible, physical medium which can beused to store the desired information and which can be accessed by thecomputing device 102. Any such non-transitory computer-readable mediamay be part of the computing device 102.

In further implementations, computing device 102 also has input anddevice(s) 136, such as a keyboard, a mouse, a touch-sensitive display, avoice input device, a display, speakers, a printer, etc. These devicesare well known in the art and need not be discussed at length here. Onesof such input/output devices 136 may be among the enumerated bus devices104-108 and 134 or may be connected to computing device 102 throughdifferent mechanisms (e.g., a video graphics array (VGA) connector).

The computing device 102 also contains communication connections 138that allow the computing device 102 to communicate with other computingdevices, such as device(s) of the security service cloud 110.

In various implementations, the operating system (OS) 116 may be anysort of operating system, such as a Windows® operating system, aUNIX-based operating system, etc. The OS 116 may be any sort of softwarethat supports basic functions of the computing device 102, such asscheduling tasks, executing applications, and controlling peripherals(such as enumerated bus devices).

The registry 118 is a database that stores low-level settings for the OS116 and for applications of computing device 102 configured to use theregistry 118. The registry 118 may also be part of OS 116 or a separatecomponent that interfaces with the OS 116. The kernel of OS 116, devicedrivers (including enumerated bus device drivers 120), and otherservices may all use the registry 118. Settings stored in the registry118 may be stored as values associated with registry keys of theregistry 118.

The PnP manager 120 supports plug-and-play functionality for the OS 116,and may be part of OS 116 or a separate, interfacing component. The PnPmanager 120 is responsible for PnP device detection and enumerationduring a boot phase of the computing device 102 or of attached PnPdevices (e.g., enumerated bus devices) and for adding/removing PnPdevices while the system is running. PnP devices include enumerated busdevices, such as hub 104, mouse, 106, thumb drive 108, and otherenumerated bus devices 134, and PnP manager 120 accordingly manages andinterfaces with such devices. Among its functions, the PnP manager 120may call the DriverEntry and AddDevice routines of any PnP device driver(including enumerated bus device drivers) and may send a start devicecommand (e.g., IRP_MN_START_DEVICE) to PnP devices (including enumeratedbus devices). The PnP manager 120 may also build and maintain a PnPdevice tree of PnP devices on the computing device 102 based oninformation received from drivers of those PnP devices.

In some implementations, device stacks 122 each correspond to a devicenode for an enumerated bus device in a PnP device tree. Each devicestack 122 includes at least one device object associated with a PnPdriver. For example, each device stack 122 includes at least a PDO 124for the PnP enumerated bus driver of an enumerated bus device. Creationof the PDO 124 may precede creation of the device stack 122 and thedevice stack 122 may be created with the PDO 124 as thebase/lowest-level device object of the device stack 122. The devicestack 122 may also include an FDO 140 associated with a function driverfor the enumerated bus device, the function driver handling read, write,and device control requests received, for example, from the PnP manager120 or from a filter driver. Above or below the FDO 140 in the devicestack 122, the device stack 122 may include one or more filter deviceobjects associated with filter drivers, such as PnP driver 126. Suchfilter drivers may be upper-device filters, with their object placedabove the FDO 140 in a device stack 140, or lower-device filters, withtheir object placed between the FDO 140 and PDO 124 in a device stack122.

In FIG. 1, three device stacks 122 are shown for illustrative purposes.Device stack 122 a corresponds to hub 104. Device stack 122 bcorresponds to mouse 106. Device stack 122 c corresponds to thumb drive108. Device stack 122 a includes PDO 124 a, FDO 140 a, and an object forPnP driver 126 a attached as an upper-device filter. Device stack 122 bincludes PDO 124 b, FDO 140 b, and an object for PnP driver 126 battached as a lower-device filter. Device stack 122 c includes PDO 124c, FDO 140 c, and an object for PnP driver 126 c attached as alower-device filter. As discussed further herein, PnP driver 126attaches as an upper-device filter for hubs and controllers and as alower-device filter for other enumerated bus devices.

In various implementations, PnP driver 126 may create a CDO 128 toenable communication between the PnP driver 126 and security agent 130.CDO 128 may be any sort of CDO, such as an object representing asoftware-only virtual device. The CDO 128 may not be part of the devicestacks 122 but may be utilized by drivers that are part of the devicestacks 122, such as PnP driver 126, for communication with user-modeprocesses or threads, such as security agent 130.

Operations

FIGS. 2-5 illustrate example processes 200, 300, 400, and 500. Theseprocesses are illustrated as logical flow graphs, each operation ofwhich represents a sequence of operations that can be implemented inhardware, software, or a combination thereof. In the context ofsoftware, the operations represent computer-executable instructionsstored on one or more computer-readable storage media that, whenexecuted by one or more processors, perform the recited operations.Generally, computer-executable instructions include routines, programs,objects, components, data structures, and the like that performparticular functions or implement particular abstract data types. Theorder in which the operations are described is not intended to beconstrued as a limitation, and any number of the described operationscan be combined in any order and/or in parallel to implement theprocesses.

FIG. 2 illustrates an example process for loading a plug-and-play (PnP)driver as an upper-device filter in a device stack of a root hub or anon-root hub of a computing device and for attaching the PnP driver todevice stacks of other enumerated bus devices of the computing device aseither an upper-device filter or lower-device filter depending on deviceclasses of those enumerated bus devices. Process 200 illustrates, at202, the security agent 130 or PnP driver 126 receiving, and applyingwhile live, a configuration update without rebooting. Such an update mayaffect policies, IoAs, threat responses, etc. If both the security agent130 and PnP driver 126 are loaded, the configuration update may beprovided through CDO 128, as described further herein. While thereceiving of the configuration update at 202 is shown as occurringbefore loading of the PnP driver 126 and attaching of it to devicestacks 122, the receiving at 202 may occur at any point during theoperations shown at FIGS. 2-5.

At 204, the security agent 130 may cause the computing device 102 toload the PnP driver 126 as an upper-device filter in a device stack 122of a hub. This may include, at 206, writing a registry key to theregistry 118 to indicate to OS 116 that the PnP driver 126 should beloaded as an upper-device filter in the device stack 122 of the hub uponinitialization of the hub. The security agent 130 may then restart thehub, at 208, to cause the OS 116 to load the PnP driver 126 (e.g., bycalling its AddDevice routine). After its AddDevice routine is called,the PnP driver 126 may inspect the device instance path for to determineif the device is a hub. Based on that inspection, the PnP driver 126attaches to the device stack 122 of the hub as an upper-device filter.

At 210, the PnP driver 126 then receives a message listing an enumeratedbus device that is connected to the computing device 102. For example,when the PnP manager 120 issues a request (e.g.,IRP_MN_QUERY_DEVICE_RELATIONS) to the bus driver for it to enumerate theenumerated bus devices attached to it, the PnP driver 126, as anupper-device filter in the device stack 122 of the hub, will see boththat request and the response. The PnP driver 126 may also check toensure that it is attached to the device stack 122 of a hub as the PnPdriver 126 may not be configured to evaluate enumerations received fromnon-hub devices.

At 212, the PnP driver 126 determines whether at least one enumeratedbus device mentioned in the received message belongs to a device class.For example, for each enumerated bus device mentioned in an enumerationresponse from the hub driver, the PnP driver 126 may determine the typeof the enumerated bus device. To determine the type of each enumeratedbus device, the PnP driver may issue a request for the indicativefeatures for that enumerated bus device (e.g., from the hub driver).

At 214, the PnP driver 126 then attaches as an upper-device filter or alower-device filter in a device stack 122 associated with each of theenumerated enumerated bus devices. For example, if the indicativefeatures for a given device indicates that it is a hub or controller,the PnP driver 126 waits for its AddDevice routine to be invoked to beadded as an upper-device filter for that hub or controller. If theindicative features indicate that the enumerated bus device is adifferent sort of enumerated bus device, other than a hub or controller,then the PnP driver 126 attaches to the device stack 122 of thatenumerated bus device as a lower-device filter.

In some implementations, an enumerated bus device may include multipledevice drivers and multiple associated device stacks 122. For suchdevices, it is possible that the PnP driver 126 may attach as anupper-device filter in one of the device stacks 122 and as alower-device filter in another of the device stacks 122.

FIG. 3 illustrates an example process for taking actions by a PnP driverattached or attaching to a device stack of an enumerated bus device as afilter, including altering, limiting, or otherwise blocking,inventorying, and fingerprinting, among others. Process 300 shows, at302-320, a number of different operations that the PnP driver 126 mayperform when attached/loaded to device stack(s) 122.

At 302, the PnP driver 126 may compare indicative features, traffic,fingerprints (described further herein), or other information for anenumerated bus device to IoAs. Such IoAs may be configurable policiesthat form part of a configuration of the PnP driver 126. During adecision phase for altering, limiting, or otherwise blocking ofenumerated bus devices, the PnP driver 126 may utilize the IoAs todetermine whether to alter, limit, or otherwise block ones of theenumerated bus devices. For example, the PnP driver 126 may retrieve theindicative features for an enumerated bus device, as mentioned above,and determine that information included in the indicative featuresmatches an IoA. The PnP driver 126 may then store an indicator that theenumerated bus device associated with the indicative features is to bealtered, limited, or otherwise blocked in an enforcement phase.

At 304, the PnP driver 126 may take action to alter, limit, or otherwiseblock functionality of an enumerated bus device. Such action may occurduring an enforcement phase and may have been made based on matches withone or more IoAs. Altering, limiting, or otherwise blocking offunctionality is discussed in greater detail with reference to FIG. 4.

At 306-308, the PnP driver 126 may take further diagnostic actions thatit may then use to provide intelligence to the security agent 130 orsecurity service cloud 110 or to alter, limit, or otherwise block anenumerated bus device. At 306, the PnP driver 126 requests through adevice stack 122 that the enumerated bus device associated with thatdevice stack 122 perform an action. For example, the PnP driver 126 maytransmit a USB request block (URB) to the driver of the enumerated busdevice requesting that it perform an action. At 308, the PnP driver 126monitors the traffic generated responsive to the request to determinewhether the at least one enumerated bus device has performed therequested action. For example, if the enumerated bus device is claimingto be a keyboard, and the response to the request either shows thedevice performing an action that a keyboard cannot perform or failing toperform a task that a keyboard can perform, the PnP driver 126 mayconclude that the enumerated bus device is not in fact a keyboard.

At 310, the PnP driver 126 may perform an inventory of enumerated busdevices connected to the computing device 102 by examining messagespassed through device stacks 122 of the enumerated bus devices. Suchmessages may include enumerations of child devices, indicative features,configuration descriptors, interface descriptors, interface associationdescriptors (IADs), human interface device (HID) classes, OS descriptors(e.g., Microsoft® OS descriptors (MODs)), device serial numbers, otherdevice identifiers provided by the OS 116 or by vendors of theenumerated bus devices (e.g., through firmware or hardware), devicelocation information, and/or other traffic. For example, the inventorymay include an enumeration of enumerated bus ports available on thecomputing device 102, types of enumerated bus technology used on thecomputing device 102, internal or external hubs of the computing device102, numbers of ports associated with each hub of the computing device102, speeds of ports of the computing device 102, power draws of portsof the computing device 102, type(s) of controller(s) on the computingdevice 102, identifications of any port that a keyboard is plugged into, or identifications of any port that a mass storage device or ahacking device is plugged in to. At 312, the PnP driver 126 may thenreport the inventory to the security agent 130 or security service cloud110. The inventory may be organized as a PnP device tree. The PnP driver126 may construct the tree by retrieving the tree maintained by the OS116 and by updating that tree.

At 314, the PnP driver 126 may create a fingerprint for an enumeratedbus device based on information collected by the PnP driver 126, such asthe information collected for the system inventory and/or otherinformation captured from enumerations, indicative features,configuration descriptors, interface descriptors, IADs, HID classes, OSdescriptors (e.g., MODs), device serial numbers, other deviceidentifiers provided by the OS 116 or by vendors of the enumerated busdevices (e.g., through firmware or hardware), device locationinformation, and/or device stack traffic. At 316, creating thefingerprint may be based on both the information collected by the PnPdriver 126 and on information gathered by a cloud service, such assecurity service cloud 110. In such implementations, the securityservice cloud 110 may provide information to the computing device 102 toenable fingerprint creation by the PnP driver 126 or security agent 130,or the PnP driver 126 may provide information to the security servicecloud 110 to enable fingerprint creation by the security service cloud110. The fingerprint may then be included in subsequent deployments ofconfigurations for the security agent 130 and/or the PnP driver 126 tobe used to trigger altering, limiting, or otherwise blocking ormonitoring.

At 318, the PnP driver 126 may create a CDO 128 to communicate with auser-mode process or thread, such as security agent 130. At 320, the PnPdriver 126 may then subsequently remove the CDO 128 when either a countassociated with enumerated bus devices connected to the computing device102 reaches zero or when the PnP driver 126 receives a shutdown commandfrom the user-mode process or thread. The actions shown at 318-320 aredescribed below in further detail with respect to FIG. 5.

FIG. 4 illustrates an example process for taking action by a PnP driverto alter, limit, or otherwise block functionality of an enumerated busdevice. Process 400 shows, at 402, the PnP driver 126 receives a messagedirected through the device stack 122 of an enumerated bus device thatthe PnP driver 126 is attached to. The message may specify indicativefeatures of at least one of the enumerated bus devices connected to thecomputing device 102 or command the at least one of the enumerated busdevices to take an action. For example, the message may be a response toan enumeration request received at a device stack 122 of a hub device.The message may list enumerated bus devices connected to the hub device.The PnP driver 126 may then query for information associated with thoselisted enumerated bus devices and make an altering, limiting, orotherwise blocking decision for each such enumerated bus device. Forexample, as discussed further herein, the PnP driver 126 may compare theinformation received in the message to one or more fingerprints orconfigurable policies to determine whether to alter, limit, or otherwiseblock an enumerated bus device. If the PnP driver 126 decides to alter,limit, or otherwise block functionality of the enumerated bus device,the PnP driver 126 may store an indication of the decision for use in asubsequent enforcement phase. In one implementation, the PnP driver 126may also store an indication of a method to be used in altering,limiting, or otherwise blocking functionality of the enumerated busdevice.

At 404, the PnP driver 126 takes action to alter, limit, or otherwiseblock functionality of an enumerated bus device. Such action may occurin an enforcement phase (e.g., during installation or starting of theenumerated bus device).

At 406, the action taken may be sending a request to a hub devicerequesting that an individual port of the hub associated with theenumerated bus device be powered off, disabled, or power cycled.

Alternatively, at 408, the action may be altering installation stringsor capability flags for the enumerated bus device. The PnP driver 126may filter the PnP manager 120's IRP_MN_QUERY_ID message and alter thereturned strings (e.g., hardware ID strings and/or compatibility IDstrings) to a string that does not map to any driver INF file on thecomputing device 102, or which alters the strings to map to a differentINF file. The technique may then further include the PnP driver 126filtering and altering flags in IRP_MN_QUERY_CAPABILTIES, for purposessuch as stealth blocking, so as not to alert the user in device manager,toasts, popups, or other user indications.

In another implementation, a set of files associated with the PnP driveror security service are pre-installed into the system that register thePnP driver or security service as a new “device class”. At that point,the installation string is modified to pretend that the device is partof the new device class, and various other descriptive strings are setto those of the blocked device. This may cause the operating system tolook for a descriptor for this device class, and it finds the new deviceclass, which says “Blocked Device”. Because such files arepre-installed, the PnP driver or security service is effectively addedto the operating system Device Manager and a user can see the device, aswell as any descriptive strings encoded from the original device.Furthermore, a “property sheet library” is also installed, whichdisplays a custom interface to the user when they double click on such adevice (e.g., from within the Microsoft Device Manager UI), includingwith a password-protected unblock command and other capabilities, suchas to inspect device property details and to determine why the devicewas blocked.

Alternatively, at 410, the action may be failing, by the PnP driver, astart routine initiated by a start device message received from a PnPmanager 120. The PnP manager 120 may send an IRP_MN_START_DEVICE messagewhich may be received by the FDO 140 of the enumerated bus device. Thefunctional driver of the enumerated bus device is then loaded and themessage passed to the PnP driver 126. The PnP driver 126 then returns afailure status code to PnP manager 120, causing the function driver tobe unloaded and the device stack 122 to be torn down.

Alternatively, at 412, the action may be returning a failure status foran AddDevice routine to a PnP manager 120 to cause a device stack forthe enumerated bus device to be torn down. Such a technique may be used,for example, for hub or controller devices for which the PnP driver126's AddDevice routine is called.

Alternatively, at 414, the action may be removing an identification ofthe enumerated bus device from an enumeration of the one or moreenumerated bus devices. Such a removal may be made by the PnP driver 126to the enumeration response from a hub driver. When the PnP manager 120receives the altered response, it will not see an identification of theenumerated bus device and thus will not allocate PnP resources to it andthe device will not function at all on the system

Alternatively, at 416, the action may be suspending the enumerated busdevice by updating a state machine of a hub device. Thissuspension—referred to as selective suspend—may be achieved via PnPmessages to the PnP manager 120 rather than through direct communicationwith the hub device.

Alternatively, at 418, the action may be any other sort of altering,limiting or blocking action taken based at least on part on configurablepolicies of the PnP driver 126.

FIG. 5 illustrates an example process for creating, by a PnP driver, acontrol device object (CDO) to enable communication with a user-modeprocess or thread and for removing the CDO. Process 500 illustrates, at502, the PnP driver 126 creating a CDO 128 to communicate with auser-mode process or thread, such as security agent 130. The PnP driver126 may create the CDO 128 during a first device start command for afirst enumerated bus device (e.g., IRP_MN_START_DEVICE). Alternatively,the PnP driver 126 may create the CDO 128 in its DriveEntry, which iscalled when the PnP driver 126 is first loaded. Once created, the PnPdriver 126 can receive and respond to commands from a user-mode processor thread, such as security agent 130, through the CDO 128 and/orreceive configuration/policy updates from a user-mode process or thread,such as security agent 130, through the CDO 128.

At 504, the PnP driver 126 removes the CDO 128 when a count associatedwith enumerated bus devices connected to the computing device reacheszero. The PnP driver 126 may keep a count of enumerated bus devices byincrementing a counter for each start device message (e.g.,IRP_MN_START_DEVICE) sent and decrementing the counter for each removedevice message (e.g., IRP_MN_REMOVE_DEVICE) sent. When the counterreaches zero, the PnP driver 126 may then remove the CDO 128.

Alternatively to 504, at 506, the PnP driver 126 removes the CDO 128when the PnP driver 126 receives a shutdown command from the user-modeprocess or thread. At 508, the user-mode process or thread opens ahandle to the CDO 128 and issues a shutdown command to the PnP driver126, e.g., as an IOCTL. At 510, in response to the shutdown command, thePnP driver 126 takes a reference on the CDO 128 and deletes the CDO 128.However, the CDO 128 remains because of the reference taken to it. At512, the user-mode process or thread closes the handle to the CDO 128,which causes cleanup and close messages (e.g., IRP_MJ_CLEANUP andIRP_MJ_CLOSE) to be emitted, in that order, to the PnP driver 126. At514, upon receiving the close message, and remembering that theuser-mode process or thread previously sent the shutdown command, thePnP driver 126 removes the last reference on the CDO 128, which resultsin the removal of the CDO 128. Because the CDO 128 has been removed, thePnP driver 126 may be subsequently unloaded (e.g., upon restart of allenumerated bus devices).

CONCLUSION

Although the subject matter has been described in language specific tostructural features and/or methodological acts, it is to be understoodthat the subject matter defined in the appended claims is notnecessarily limited to the specific features or acts described. Rather,the specific features and acts are disclosed as exemplary forms ofimplementing the claims.

What is claimed is:
 1. A system comprising: a processor; and a PnPdriver attached as a filter in a device stack of an enumerated busdevice of one or more enumerated bus devices plugged in to the system,the PnP driver being operated by the processor to: receive a messagedirected through the device stack, the message specifying indicativefeatures of at least one of the one or more enumerated bus devices orcommanding the at least one of the one or more enumerated bus devices totake an action; and based on the message, take an action to alter,limit, or otherwise block functionality of the at least one of the oneor more enumerated bus devices, wherein the action includes: sending arequest to a hub device requesting that an individual port of the hubdevice associated with the at least one of the one or more enumeratedbus devices be powered off, disabled, or power cycled, or suspending theat least one of the one or more enumerated bus devices by updating astate machine of a hub device.
 2. The system of claim 1, wherein theaction additionally or alternatively includes failing, by the PnPdriver, a start routine initiated by a start device message receivedfrom a PnP manager.
 3. The system of claim 1, wherein the actionadditionally or alternatively includes returning a failure status for anadd device routing to a PnP manager to cause a device stack for the atleast one of the one or more enumerated bus devices to be torn down. 4.The system of claim 1, wherein taking the action is based at least onpart on configurable policies of the PnP driver.
 5. The system of claim1, wherein the action additionally or alternatively includes alteringinstallation strings for the at least one of the one or more enumeratedbus devices.
 6. The system of claim 1, wherein the action additionallyor alternatively includes altering capability flags for the at least oneof the one or more enumerated bus devices.
 7. A method implemented in aPnP driver attached as a filter in a device stack of an enumerated busdevice of one or more enumerated bus devices, the method comprising:receiving, by the PnP driver, a message directed through the devicestack, the message commanding at least one of the one or more enumeratedbus devices to take an action; and based on the message, taking, by thePnP driver, an action to alter, limit, or otherwise block functionalityof the at least one of the one or more enumerated bus devices, whereinthe action includes: sending a request to a hub device requesting thatan individual port of the hub device associated with the at least one ofthe one or more enumerated bus devices be powered off, disabled, orpower cycled, or suspending the at least one of the one or moreenumerated bus devices by updating a state machine of a hub device. 8.The method of claim 7, wherein the action additionally or alternativelyincludes altering installation strings or capability flags for the atleast one of the one or more enumerated bus devices.
 9. The method ofclaim 7, wherein taking the action is based at least on part onconfigurable policies of the PnP driver.
 10. The method of claim 7,wherein the action additionally or alternatively includes failing, bythe PnP driver, a start routine initiated by a start device messagereceived from a PnP manager.
 11. The method of claim 7, wherein theaction additionally or alternatively includes returning a failure statusfor an add device routing to a PnP manager to cause a device stack forthe at least one of the one or more enumerated bus devices to be torndown.
 12. A non-transitory computer-readable medium having programminginstructions stored thereon that, when executed by a PnP driver performoperations comprising: receiving, by the PnP driver, a message directedthrough a device stack, the message specifying indicative features of atleast one of one or more enumerated bus devices or commanding the atleast one of the one or more enumerated bus devices to take an action,wherein the PnP driver is attached as a filter in the device stack of anenumerated bus device of the one or more enumerated bus devices; andbased on the message, taking, by the PnP driver, an action to alter,limit, or otherwise block functionality of the at least one of the oneor more enumerated bus devices, wherein the action includes: sending arequest to a hub device requesting that an individual port of the hubassociated with the at least one of the one or more enumerated busdevices be powered off, disabled, or power cycled, or suspending the atleast one of the one or more enumerated bus devices by updating a statemachine of a hub device.
 13. The non-transitory computer-readable mediumof claim 12, wherein the action additionally or alternatively includesaltering installation strings or capability flags for the at least oneof the one or more enumerated bus devices.
 14. The non-transitorycomputer-readable medium of claim 12, wherein the action additionally oralternatively includes failing, by the PnP driver, a start routineinitiated by a start device message received from a PnP manager.
 15. Thenon-transitory computer-readable medium of claim 12, wherein the actionadditionally or alternatively includes returning a failure status for anadd device routing to a PnP manager to cause a device stack for the atleast one of the one or more enumerated bus devices to be torn down. 16.The non-transitory computer-readable medium of claim 12, wherein takingthe action is based at least on part on configurable policies of the PnPdriver.